<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>pthread_cond_signal</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_007_1252">&nbsp;</a>NAME</h4><blockquote>
pthread_cond_signal, pthread_cond_broadcast - signal or broadcast a
condition
</blockquote><h4><a name = "tag_000_007_1253">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="pthread.h.html">pthread.h</a>&gt;

int pthread_cond_signal(pthread_cond_t *<i>cond</i>);
int pthread_cond_broadcast(pthread_cond_t *<i>cond</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_007_1254">&nbsp;</a>DESCRIPTION</h4><blockquote>
These two functions are used to unblock
threads blocked on a condition variable.
<p>
The
<i>pthread_cond_signal()</i>
call unblocks at least one of the threads that are blocked on the
specified condition variable
<i>cond</i>
(if any threads are blocked on
<i>cond</i>).
<p>
The
<i>pthread_cond_broadcast()</i>
call unblocks all threads currently blocked on the specified condition variable
<i>cond</i>.
<p>
If more than one thread is blocked on a condition variable,
the scheduling policy determines the order in which threads are unblocked.
When each thread unblocked as a result of a
<i>pthread_cond_signal()</i>
or
<i>pthread_cond_broadcast()</i>
returns from its call to
<i><a href="pthread_cond_wait.html">pthread_cond_wait()</a></i>
or
<i><a href="pthread_cond_timedwait.html">pthread_cond_timedwait()</a></i>,
the thread owns the mutex with which it called
<i><a href="pthread_cond_wait.html">pthread_cond_wait()</a></i>
or
<i><a href="pthread_cond_timedwait.html">pthread_cond_timedwait()</a></i>.
The thread(s) that are unblocked contend for the mutex
according to the scheduling policy (if applicable),
and as if each had called
<i><a href="pthread_mutex_lock.html">pthread_mutex_lock()</a></i>.
<p>
The
<i>pthread_cond_signal()</i>
or
<i>pthread_cond_broadcast()</i>
functions may be called by a thread whether or not it
currently owns the mutex that threads calling
<i><a href="pthread_cond_wait.html">pthread_cond_wait()</a></i>
or
<i><a href="pthread_cond_timedwait.html">pthread_cond_timedwait()</a></i>
have associated with the condition variable during their waits;
however, if predictable scheduling behaviour is required,
then that mutex is locked by the thread calling
<i>pthread_cond_signal()</i>
or
<i>pthread_cond_broadcast()</i>.
<p>
The
<i>pthread_cond_signal()</i>
and
<i>pthread_cond_broadcast()</i>
functions have no effect if there are no threads
currently blocked on
<i>cond</i>.
</blockquote><h4><a name = "tag_000_007_1255">&nbsp;</a>RETURN VALUE</h4><blockquote>
If successful, the
<i>pthread_cond_signal()</i>
and
<i>pthread_cond_broadcast()</i>
functions return zero.
Otherwise, an error number is returned to indicate the error.
</blockquote><h4><a name = "tag_000_007_1256">&nbsp;</a>ERRORS</h4><blockquote>
The 
<i>pthread_cond_signal()</i>
and
<i>pthread_cond_broadcast()</i>
function may fail if:
<dl compact>

<dt>[EINVAL]<dd>
The value
<i>cond</i>
does not refer to an initialised condition variable.

</dl>
<p>
These functions will not return an error code of [EINTR].
</blockquote><h4><a name = "tag_000_007_1257">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_1258">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_1259">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_1260">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="pthread_cond_init.html">pthread_cond_init()</a></i>,
<i><a href="pthread_cond_wait.html">pthread_cond_wait()</a></i>,
<i><a href="pthread_cond_timedwait.html">pthread_cond_timedwait()</a></i>,
<i><a href="pthread.h.html">&lt;pthread.h&gt;</a></i>.
<br>
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from the POSIX Threads Extension (1003.1c-1995)
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

